# import numpy as np
# A = np.eye(2) * 2
# B = np.eye(3) * 3
# C = np.block([
#     [A,               np.zeros((2, 3))],
#     [np.ones((3, 2)), B               ]
# ])
# print(C)

import torch
# logits = torch.rand(2,3)
# logits[0][0] = 1.
# logits[0][1] = 2.
# logits[0][2] = 3.
# logits[1][0] = 4.
# logits[1][1] = 5.
# logits[1][2] = 6.
# mm = torch.empty((2,3))
# print(mm)
# print(torch.norm(mm,p="fro"))
# aa = -torch.empty_like(logits, memory_format=torch.legacy_contiguous_format)
# bb = -torch.empty_like(logits, memory_format=torch.legacy_contiguous_format).exponential_().log()
# print(aa)
# print(bb)
from math import *
def schatten_norm(matrix,p=0.5):
    _, sigma, _ = torch.svd(matrix, some=True)
    print(matrix)
    print(sigma)
    return torch.pow(torch.sum(torch.pow(sigma,p)),1/p)

a = torch.ones(3,3)
b = torch.eye(3,3)
_, sigma1, _ = torch.svd(a, some=True)
_, sigma2, _ = torch.svd(b, some=True)
print('-----------')
print(schatten_norm(a))
print(schatten_norm(b))



